package com.hashtab;

import java.util.Scanner;

public class HashTabDemo {
    public static void main(String[] args) {
        HashTab hashTab = new HashTab(7);

        // 写一个简单的菜单
        int key;
        Scanner scanner = new Scanner(System.in);
        while (true) {
            System.out.println("1: 添加雇员");
            System.out.println("2: 显示雇员");
            System.out.println("3: 查找雇员");
            System.out.println("4: 删除雇员");
            System.out.println("5: 退出系统");

            key = scanner.nextInt();
            switch (key) {
                case 1:
                    System.out.println("输入id：");
                    int id = scanner.nextInt();
                    System.out.println("输入名字：");
                    String name = scanner.next();
                    // 创建 雇员
                    Emp emp = new Emp(id, name);
                    hashTab.add(emp);
                    break;
                case 2:
                    hashTab.showAllList();
                    break;
                case 3:
                    System.out.println("请输入要查找的id");
                    id = scanner.nextInt();
                    hashTab.findEmpById(id);
                    break;
                case 4:
                    System.out.println("请输入要删除的id");
                    id = scanner.nextInt();
                    hashTab.deleteEmpById(id);
                    break;
                case 5:
                    scanner.close();
                    System.exit(0);
                default:
                    break;
            }
        }
    }

}
